home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2c.lha / p4-1.2c / lib / p4_defs.h < prev    next >
C/C++ Source or Header  |  1993-05-24  |  5KB  |  205 lines

  1. #ifndef _P4_DEFS_H_
  2. #define _P4_DEFS_H_
  3.  
  4. struct proc_info {
  5.     int port;
  6.     int switch_port;
  7.     int unix_id;
  8.     int slave_idx;
  9.     int group_id;
  10.     P4BOOL am_rm;
  11.     char host_name[HOSTNAME_LEN];
  12.     char machine_type[16];
  13. };
  14.  
  15. #define NUMAVAILS 8
  16.  
  17. struct p4_avail_buff {
  18.     int size;            /* size of message portion */
  19.     struct p4_msg *buff;
  20. };
  21.  
  22. struct p4_global_data {
  23. #   ifdef SYSV_IPC
  24.     int sysv_num_semids;
  25.     int sysv_semid[P4_MAX_SYSV_SEMIDS];
  26.     int sysv_next_lock;
  27. #   endif
  28.     struct proc_info proctable[P4_MAXPROCS];
  29.     int listener_pid;
  30.     int listener_port;
  31.     P4BOOL local_communication_only;
  32.     int local_slave_count;
  33.     int n_forked_pids;
  34.     char my_host_name[HOSTNAME_LEN];
  35.     struct p4_avail_buff avail_buffs[NUMAVAILS];
  36.     p4_lock_t avail_buffs_lock;
  37.     struct p4_queued_msg *avail_quel;
  38.     p4_lock_t avail_quel_lock;
  39.     struct p4_msg_queue shmem_msg_queues[P4_MAX_MSG_QUEUES];
  40.     int num_in_proctable;
  41.     int num_installed;
  42.     p4_lock_t slave_lock;
  43.     int dest_id[P4_MAXPROCS];
  44.     int listener_fd;
  45.     int max_connections;
  46.     int cube_msgs_out;    /* i860 msgs not yet msgwait'ed on */
  47.     long reference_time;  /* used in p4_initenv and p4_clock */
  48.     int hi_cluster_id;
  49.     int low_cluster_id;
  50.     P4VOID *cluster_shmem;
  51.     p4_barrier_monitor_t cluster_barrier;
  52.     char application_id[12];
  53. } *p4_global;
  54.  
  55.  
  56. struct connection {
  57.     int type;
  58.     int port;
  59.     int switch_port;
  60.     P4BOOL same_data_rep;
  61. };
  62.  
  63. struct local_data {        /* local to each process */
  64.     int listener_fd;
  65.     int my_id;
  66.     int local_commtype;        /* cube or shmem messages */
  67.     struct p4_msg_queue *queued_messages;
  68.     P4BOOL am_bm;
  69.     struct connection *conntab;    /* pointer to array of connections */
  70.     struct p4_procgroup *procgroup;
  71.     int soft_errors;            /* false if errors cause termination */
  72.     char *xdr_buff;
  73.     XDR xdr_enc;
  74.     XDR xdr_dec;
  75. } *p4_local;
  76.  
  77. struct listener_data {
  78.     int listening_fd;
  79.     int slave_fd;
  80. } *listener_info;
  81.  
  82.  
  83. /* this struct is similar to a p4_net_msg_hdr;  note that the sum of
  84.    the sizes of the items up to the *msg is equal to some number of 
  85.    double words, which is important on machines like bfly2 if you 
  86.    receive doubles into the msg area.
  87. */
  88. /* link, orig_len, and pad are for the buffer itself*/
  89. /* next fields are for the current message in the buffer */
  90. struct p4_msg {
  91.     struct p4_msg *link;
  92.     int orig_len;
  93.     int pad;
  94.     int type;                
  95.     int to;
  96.     int from;
  97.     int ack_req;
  98.     int len;
  99.     int msg_id;                /* for i860 messages */
  100.     int data_type;        /* for use by xdr */
  101.     char *msg;    /* variable length array of characters */
  102. };
  103.  
  104. struct p4_net_msg_hdr {
  105.     int msg_type:32;
  106.     int to:32;
  107.     int from:32;
  108.     int ack_req:32;
  109.     int msg_len:32;
  110.     int msg_id:32;        /* for i860 messages */
  111.     int data_type:32;        /* for use by xdr */
  112.     int pad:32;                 /* pad field to word boundary */
  113. };
  114.  
  115. struct net_initial_handshake {
  116.    int pid:32;
  117.    int pad:32;
  118. };
  119.  
  120. struct p4_queued_msg {
  121.     struct p4_msg *qmsg;
  122.     struct p4_queued_msg *next;
  123. };
  124.  
  125.  
  126. /* Messages between a listener and any other non-listener */
  127.  
  128. #define DIE   1
  129. #define SLAVE_DYING   2     /* Unused.  Check for whole data struct. */
  130. #define CONNECTION_REQUEST   3
  131. #define IGNORE_THIS   4
  132.  
  133. struct slave_listener_msg {
  134.     int type:32;
  135.     int from:32;
  136.     int to:32;
  137.     int to_pid:32;
  138.     int lport:32;
  139.     int pad:32;
  140. };
  141.  
  142. /* Messages between the bm and a rm at startup */
  143.  
  144. #define INITIAL_INFO            11
  145. #define REMOTE_LISTENER_INFO    12
  146. #define REMOTE_SLAVE_INFO       13
  147. #define REMOTE_MASTER_INFO      14
  148. #define REMOTE_SLAVE_INFO_END   15
  149. #define PROC_TABLE_ENTRY        16
  150. #define PROC_TABLE_END          17
  151. #define SYNC_MSG                18
  152.  
  153. struct bm_rm_msg {
  154.     int type:32;
  155.  
  156.     /* for INITIAL_INFO */
  157.     int numslaves:32;
  158.     int numinproctab:32;
  159.     int memsize:32;
  160.     int rm_num:32;
  161.     int debug_level:32;
  162.     int logging_flag:32;
  163.  
  164.     /* for REMOTE_LISTENER_INFO */
  165.     int port:32;
  166.  
  167.     /* for REMOTE_SLAVE_INFO and REMOTE_MASTER_INFO */
  168.     int slave_idx:32;
  169.     int slave_pid:32;
  170.     int am_rm:32;
  171.  
  172.     /* for PROC_TABLE_ENTRY */
  173.     int unix_id:32;
  174.     int group_id:32;
  175.     int switch_port:32;
  176.     /* int pad:32;  to keep number of 32 bit quantities even */
  177.     char host_name[HOSTNAME_LEN];
  178.  
  179.     /* also for INITIAL INFO */
  180.     char pgm[128];
  181.     char version[8];
  182.     char outfile[128];
  183.     char application_id[16];
  184.     char machine_type[16];
  185. };
  186.  
  187. #define P4_ACK_REQ_MASK   1     /* Masks define bits set for requests */
  188. #define P4_ACK_REPLY_MASK 2
  189. #define P4_BROADCAST_MASK 4
  190.  
  191. struct p4_brdcst_info_struct {
  192. /*
  193.   This structure is initialized by init_p4_brdcst_info() which
  194.   is automatically called by every global operation
  195. */
  196.   int initialized;             /* True if structure is initialized */
  197.   int up;                      /* Process above me in tree         */
  198.   int left_cluster;            /* Id of left child cluster master  */
  199.   int right_cluster;           /* Id of right child cluster master */
  200.   int left_slave;              /* Id of left child slave           */
  201.   int right_slave;             /* Id of right child slave          */
  202. } p4_brdcst_info;
  203.  
  204. #endif
  205.